<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>

<xsl:variable name="IPAGM">
<xsl:choose>
<xsl:when test="topology/nodes/node/software_configuration/@template='debian5_omfAgr'">
<xsl:value-of select = "topology/nodes/node/network_interfaces/interface/ip/@address"/>
</xsl:when>
</xsl:choose>
</xsl:variable>

<xsl:template match="/">
#!/bin/bash
#
<xsl:for-each select="topology/nodes/node">

<xsl:variable name="ID"><xsl:value-of select="@id"/></xsl:variable>
<xsl:variable name="temp"><xsl:value-of select="software_configuration/@template"/></xsl:variable>
<xsl:variable name="IP"><xsl:value-of select="network_interfaces/interface/ip/@address"/></xsl:variable>

<xsl:if test="$temp='debian5_omfNode'">

#questa riga serve a scrivere l'indirizzo esatto del server xmpp openfire nel nodo

ssh root@<xsl:value-of select="$IP"/> "sed -i 's/XMPP_ADDRESS/<xsl:value-of select="$IPAGM"/>/g' /etc/omf-resctl-5.2/nodeagent.yaml"

#
ssh root@<xsl:value-of select="$IP"/> "/etc/init.d/omf-resctl-5.2 restart"

#
</xsl:if>

</xsl:for-each>

</xsl:template>
</xsl:stylesheet>
